package com.wd.tech.mvp;

import com.wd.tech.base.BasePresenter;
import com.wd.tech.bean.AddCommunityGreatBean;
import com.wd.tech.contract.IContract;

import java.util.HashMap;
import org.jetbrains.annotations.Contract;

import java.util.Map;

import okhttp3.RequestBody;

/**
 * 时间：2020/7/1
 * 作者：徐黎明
 * 类的作用：
 */
public class IPresenterImpl extends BasePresenter {
    public IModelImpl iModel;
    @Override
    protected void initModel() {
        iModel=new IModelImpl();
    }

    @Override
    public void IModelRegisterInfo(String url, Map<String, Object> map, Class cls) {
        iModel.IModelRegisterInfo(url, map, cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object object) {
                getView().success(object);
            }

            @Override
            public void Error(Throwable throwable) {
                getView().Error(throwable);
            }
        });
    }
    //Xbanner
    @Override
    public void PresenterGetXBannerInfo(String url, Class cls) {
        iModel.ModelGetXBannerInfo(url, cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object object) {
                getView().success(object);
            }

            @Override
            public void Error(Throwable throwable) {
                getView().Error(throwable);
            }
        });
    }

    //展示资讯首页
    @Override
    public void PresenterGetNewsShow(String url, Map<String, Object> map, Class cls) {
        iModel.ModelGetNewsShow(url, map, cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object o) {
                getView().success(o);
            }

            @Override
            public void Error(Throwable throwable) {

            }
        });
    }

    @Override
    public void IModelAddCommunity(String url, Map<String, Object> map, Class cls) {
     iModel.ModelGetNewsShow(url, map, cls, new IContract.ModelCallBack() {
         @Override
         public void success(Object o) {
             getView().success(o);
         }

         @Override
         public void Error(Throwable throwable) {

         }
     });

    }

    @Override
    public void IModelCancleAdd(String url, Map<String, Object> map, Class cls) {

    }

    //兴趣频道
    @Override
    public void PresenterGetChannel(String url, Class cls) {

        iModel.ModelGetChannel(url, cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object object) {
                getView().success(object);
            }

            @Override
            public void Error(Throwable throwable) {
                getView().Error(throwable);
            }
        });

    }
    //频道
    @Override
    public void PresenterGetNewsChanner(String url, Map<String, Object> map, Class cls) {
        iModel.ModelGetNewsChanner(url, map, cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object o) {
                getView().success(o);
            }

            @Override
            public void Error(Throwable throwable) {

            }
        });
    }

    //频道详情
    @Override
    public void IModelReleasePost(String url, Map<String, RequestBody> map, Class cls) {
        iModel.IModelReleasePost(url, map, cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object o) {
                getView().success(o);
            }

            @Override
            public void Error(Throwable throwable) {

            }
        });
    }

    //社区
    @Override
    public void IModelCommunityInfo(String url,Map<String, Object> map, Class cls) {
        iModel.IModelCommunityInfo(url,map,cls, new IContract.ModelCallBack() {
            @Override
            public void success(Object o) {
                getView().success(o);
            }

            @Override
            public void Error(Throwable throwable) {
                getView().Error(throwable);
            }
        });
    }


}
